package io.gatling.extensions.redis

import io.gatling.core.session.Expression
import io.gatling.extensions.common.check.string.StringCheckSupport
import io.gatling.extensions.redis.builder.RedisActionBuilder
import io.gatling.extensions.redis.builder.RedisPoolActionBuilder
import io.gatling.extensions.redis.protocol.RedisProtocolBuilder

object Predef extends StringCheckSupport {

  implicit def string2Option(string: String): Option[String] = Some(string)

  def redis_pool(host: String, port: Int, password: Option[String]): RedisPoolActionBuilder = new RedisPoolActionBuilder(host, port, password)

  def redis_protocol(
             host: String,
             port: Int,
             password: Option[String] = None
           ): RedisProtocolBuilder = RedisProtocolBuilder(host, port, password)

  def redis(key: Expression[String]): RedisActionBuilder = new RedisActionBuilder(key)
}
